package cate.game.role.bag.hero;

import cate.game.role.Role;
import cate.game.train.hero.msg.HeroLockResp;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "英雄锁数据")
public class HeroLock extends Lock {
    @NoteField(value = "英雄上阵锁")
    public boolean heroFight = false;

    @NoteField(value = "英雄置换锁")
    public boolean heroReplace = false;

    @NoteField(value = "英雄共享锁")
    public boolean heroShare = false;

    @NoteField(value = "英雄聚灵锁")
    public boolean heroPendant = false;

    @NoteField(value = "英雄羁绊锁")
    public boolean heroYoke = false;

    @NoteField(value = "英雄灵契台锁")
    public boolean heroContract = false;

    @Override
    public boolean isCustomedLock() {
        return heroFight || heroReplace || heroShare || heroPendant || heroYoke || heroContract;
    }

    public void releaseReplaceLock(Role role) {
        this.heroReplace = false;
        noticeUpdate(role);
    }

    public void addReplaceLock(Role role) {
        this.heroReplace = true;
        noticeUpdate(role);
    }

    public void noticeUpdate(Role role) {
        role.sendNow(new HeroLockResp(this));
    }
}
